class EcsController < ApplicationController
  # GET /ecs
  # GET /ecs.xml
  def index
    @ecs = Ec.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @ecs }
    end
  end

  # GET /ecs/1
  # GET /ecs/1.xml
  def show
    @ec = Ec.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @ec }
    end
  end

  # GET /ecs/new
  # GET /ecs/new.xml
  def new
    @ec = Ec.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @ec }
    end
  end

  # GET /ecs/1/edit
  def edit
    @ec = Ec.find(params[:id])
  end

  # POST /ecs
  # POST /ecs.xml
  def create
    @ec = Ec.new(params[:ec])

    respond_to do |format|
      if @ec.save
        flash[:notice] = 'Ec was successfully created.'
        format.html { redirect_to(ecs_url) }
        format.xml  { render :xml => @ec, :status => :created, :location => @ec }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @ec.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /ecs/1
  # PUT /ecs/1.xml
  def update
    @ec = Ec.find(params[:id])

    respond_to do |format|
      if @ec.update_attributes(params[:ec])
        flash[:notice] = 'Ec was successfully updated.'
        format.html { redirect_to(ecs_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @ec.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /ecs/1
  # DELETE /ecs/1.xml
  def destroy
    @ec = Ec.find(params[:id])
    @ec.destroy

    respond_to do |format|
      format.html { redirect_to(ecs_url) }
      format.xml  { head :ok }
    end
  end
end
